package com.fc.v2.service;

import java.util.List;
import java.util.Arrays;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.hutool.core.util.StrUtil;
import com.fc.v2.common.base.BaseService;
import com.fc.v2.common.support.ConvertUtil;
import com.fc.v2.mapper.auto.Wsline1Mapper;
import com.fc.v2.model.auto.Wsline1;
import com.fc.v2.model.auto.Wsline1Example;
import com.fc.v2.model.custom.Tablepar;
import com.fc.v2.util.SnowflakeIdWorker;
import com.fc.v2.util.StringUtils;

/**
 * 污水管线 Wsline1Service
 * @Title: Wsline1Service.java 
 * @Package com.fc.v2.service 
 * @author Rzc_自动生成
 * @email ${email}
 * @date 2021-06-24 16:13:44  
 **/
@Service
public class Wsline1Service implements BaseService<Wsline1, Wsline1Example>{
	@Autowired
	private Wsline1Mapper wsline1Mapper;
	
      	   	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	      	
	/**
	 * 分页查询
	 * @param pageNum
	 * @param pageSize
	 * @return
	 */
	 public PageInfo<Wsline1> list(Tablepar tablepar,Wsline1 wsline1){
	        Wsline1Example testExample=new Wsline1Example();
			//搜索
			if(StrUtil.isNotEmpty(tablepar.getSearchText())) {//小窗体
	        	testExample.createCriteria().andLikeQuery2(tablepar.getSearchText());
	        }else {//大搜索
	        	testExample.createCriteria().andLikeQuery(wsline1);
	        }
			//表格排序
			//if(StrUtil.isNotEmpty(tablepar.getOrderByColumn())) {
	        //	testExample.setOrderByClause(StringUtils.toUnderScoreCase(tablepar.getOrderByColumn()) +" "+tablepar.getIsAsc());
	        //}else{
	        //	testExample.setOrderByClause("SmID ASC");
	        //}
	        PageHelper.startPage(tablepar.getPage(), tablepar.getLimit());
	        List<Wsline1> list= wsline1Mapper.selectByExample(testExample);
	        PageInfo<Wsline1> pageInfo = new PageInfo<Wsline1>(list);
	        return  pageInfo;
	 }

	@Override
	public int deleteByPrimaryKey(String ids) {
					
			Integer[] integers = ConvertUtil.toIntArray(",", ids);
			List<Integer> stringB = Arrays.asList(integers);
			Wsline1Example example=new Wsline1Example();
			example.createCriteria().andSmIDIn(stringB);
			return wsline1Mapper.deleteByExample(example);
			
				
	}
	
	
	@Override
	public Wsline1 selectByPrimaryKey(String id) {
				
			Integer id1 = Integer.valueOf(id);
			return wsline1Mapper.selectByPrimaryKey(id1);
				
	}

	
	@Override
	public int updateByPrimaryKeySelective(Wsline1 record) {
		return wsline1Mapper.updateByPrimaryKeySelective(record);
	}
	
	
	/**
	 * 添加
	 */
	@Override
	public int insertSelective(Wsline1 record) {
				
		record.setSmID(null);
		
				
		return wsline1Mapper.insertSelective(record);
	}
	
	
	@Override
	public int updateByExampleSelective(Wsline1 record, Wsline1Example example) {
		
		return wsline1Mapper.updateByExampleSelective(record, example);
	}

	
	@Override
	public int updateByExample(Wsline1 record, Wsline1Example example) {
		
		return wsline1Mapper.updateByExample(record, example);
	}

	@Override
	public List<Wsline1> selectByExample(Wsline1Example example) {
		
		return wsline1Mapper.selectByExample(example);
	}

	
	@Override
	public long countByExample(Wsline1Example example) {
		
		return wsline1Mapper.countByExample(example);
	}

	
	@Override
	public int deleteByExample(Wsline1Example example) {
		
		return wsline1Mapper.deleteByExample(example);
	}


}
